﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;

namespace AiChiTu.TraceabilitySystem.ErrorCode.Extensions
{
	/// <summary>
	/// 密码的扩展方法
	/// </summary>
	public static class PasswordExtension
	{
		/// <summary>
		/// 使用MD5技术加密字符串
		/// </summary>
		/// <param name="password">待加密的字符串</param>
		/// <returns>返回字符串</returns>
		public static string GetMD5Password(this string password)
		{
			byte[] md5Arry = MD5.Create()
				.ComputeHash(Encoding.UTF8.GetBytes(password));
			string md5string = BitConverter.ToString(md5Arry).Replace("-", "");
			return md5string;
		}
	}
}
